home *** CD-ROM | disk | FTP | other *** search
/ The Games Machine 76 / XENIATGM66.iso / Indiana Jones / Indiana Jones.exe / RESOURCE / PREVIEW.GOB / cog_tem_fallingbridge.cog < prev    next >
Text File  |  1999-11-15  |  8KB  |  291 lines

  1. # Jones 3D Cog Script
  2. #
  3. # TEM_FallingBridge.cog
  4. #
  5. # Cut the broken bridge with the Machete and watch it fall.
  6. # Then go around to the other side and climb down into the cave.
  7. #
  8. # Also added a modified version of [SXC]'s TEO_Drops.cog so it
  9. # can play ambient "creaking" sounds when it's in tact, then stop
  10. # playing them when it's broken.
  11. #
  12. # Callback section courtesy of [RT].
  13. #
  14. # [TRM]
  15. #
  16. # (C) 1999 LucasArts Entertainment Co. All Rights Reserved
  17. # ========================================================================================
  18.  
  19. symbols
  20.         
  21.     message     startup
  22.     message     entered
  23.     message     exited
  24.     message     damaged
  25.     message     pulse
  26.     message     callback
  27.         
  28.     # ** local things **
  29.     thing       player          local
  30.     thing       dustThing0      local
  31.     thing       dustThing1      local
  32.     thing       fallingBridge   local
  33.     
  34.     # ** bridge parts **
  35.     thing       staticBridge    mask=0x8        # slash this
  36.     thing       ghostBridge
  37.     thing       ghostRopes
  38.     
  39.     # ** misc things **
  40.     thing       ghostCamPos
  41.     thing       camTarget
  42.     thing       spot3           #3do spot
  43.     thing       dustPos0
  44.     thing       dustPos1
  45.  
  46.     # ** templates **
  47.     template    animBridge=10manimbridge    local
  48.     template    fallenRopes=10mbridge       local
  49.     template    dust=dustcloud              local
  50.     
  51.     # ** materials **
  52.     material    mat0=tem_4bridge_rock.mat           local
  53.     material    dustMat=gen_a4sfx_dustcloud.mat        local
  54.         
  55.     keyframe    bridgeAnim=tem_bridge_10manim.key       local
  56.         
  57.     #surface     surf0
  58.     #surface     surf1
  59.     #surface     surf2
  60.     
  61.     surface     spot0
  62.     surface     spot1
  63.     
  64.     sector      sec_MusicCue
  65.         
  66.     # ** bridge falling sounds **
  67.     sound       sndRopecut=tem_machete_bridge_c.wav     local
  68.     sound       sndFall=tem_10manimbridge_fall_c.wav    local
  69.     sound       sndHit1=fol_in_hithard.wav              local
  70.     sound       sndHit2=fol_in_hithard.wav              local
  71.     
  72.     # ** bridge creak sounds **
  73.     sound       sndBridge0=tem_bridge_b.wav             local 
  74.     sound       sndBridge1=tem_bridge_c.wav             local
  75.     
  76.     # ** music **
  77.     sound       mus_Success=mus_gen_indyrelief.wav      local
  78.     sound       mus_T2Cue=mus_tem_tiki2.wav             local
  79.     
  80.     cog         cog_Hint
  81.             
  82.     vector      dustStart       local
  83.     vector      dustEnd         local
  84.     
  85.     flex        vol=1.0
  86.     flex        minDist=-1
  87.     flex        maxDist=-1
  88.             
  89.     int         i=0             local
  90.     int         done=0          local
  91.     int         sndFalling      local
  92.     int         spot=0          local
  93.     int         sender          local
  94.     int         playedCue=0     local
  95.     int         playing=0       local
  96.     
  97. end
  98.  
  99.  
  100. # ========================================================================================
  101.  
  102. code
  103.  
  104. startup:
  105.  
  106.     # set 3dos non-mountable
  107.     ClearThingFlags(staticBridge, 0x40000000);
  108.     
  109.     # no draw
  110.     #SetFaceGeoMode(surf1, 0);
  111.     #SetFaceGeoMode(surf2, 0);
  112.     #SetFaceGeoMode(surf3, 0);
  113.     #SetFaceGeoMode(surf4, 0);
  114.     
  115.     # bridge squeak
  116.     SetPulse(2.0);
  117.         
  118.     return;
  119.  
  120. # ========================================================================================
  121.  
  122. entered:
  123.  
  124.     player = GetLocalPlayerThing();
  125.     sender = GetSenderRef();
  126.  
  127.     if((sender == spot0) || (sender == spot1) || (sender == spot3))
  128.     {
  129.         spot = 1;
  130.     }
  131.     
  132.     if((sender == sec_MusicCue) && (playedCue == 0))
  133.     {
  134.         playedCue = 1;
  135.         playing = 1;
  136.         PlaySoundLocal(mus_T2Cue, 1.0, 0.0, 0x0, 1);
  137.         playing = 0;
  138.     }
  139.         
  140.         
  141.     return;
  142.  
  143. # ========================================================================================
  144.  
  145. exited:
  146.  
  147.     player = GetLocalPlayerThing();
  148.     sender = GetSenderRef();
  149.     
  150.     if(GetSourceRef() == player)
  151.     {
  152.         if((sender == spot0) || (sender == spot1) || (sender == spot3)) 
  153.         {
  154.             spot = 0;
  155.         }
  156.     }
  157.         
  158.     return;
  159.     
  160. # ========================================================================================
  161.  
  162. damaged:
  163.  
  164.     if((GetParam(1) == 0x20) && (spot == 1) && (done == 0))
  165.     {
  166.         done = 1;
  167.  
  168.         # play slash sound
  169.         PlaySoundLocal(sndRopecut, 1.0, 0.0, 0x0, 0);
  170.         
  171.         # solve hint20
  172.         SendMessage(cog_Hint, user0);
  173.         
  174.         # do cutscene stuff
  175.         MakeMeStop();
  176.         StartCutscene(2);
  177.         
  178.         # shut down creaking sfx
  179.         SetPulse(0.0);
  180.         
  181.         Sleep(0.5);
  182.         
  183.         # play music cue
  184.         if(playing == 0) PlaySoundLocal(mus_Success, 1.0, 0.0, 0x0, 0);
  185.  
  186.         # switch to external camera
  187.         SetCurrentCamera(2);
  188.         SetCameraFocus(2, ghostCamPos);
  189.         SetCameraSecondaryFocus(2, camTarget);
  190.         SetCameraFOV(90, 0, 0.0);
  191.         
  192.         # move camera in
  193.         MoveToFrame(ghostCamPos, 1, 1.0);
  194.                     
  195.         # make the bridge fall
  196.         DestroyThing(staticBridge);
  197.         fallingBridge = CreateThing(animBridge, ghostBridge);
  198.         CaptureThing(fallingBridge);
  199.         PlayKey(fallingBridge, bridgeAnim, 5, 0x14, 0);
  200.         
  201.         Sleep(0.5);
  202.         
  203.         # create dust cloud
  204.         dustStart = VectorSet(0.2, 0.2, 0.5);
  205.         dustEnd    = VectorSet(1.2, 1.2, 0.0);
  206.         dustThing0 = CreateThing(dust, dustPos0);
  207.         CaptureThing(dustThing0);
  208.         dustThing1 = CreateThing(dust, dustPos1);
  209.         CaptureThing(dustThing1);
  210.         
  211.         # animate dust cloud
  212.         SetMaterialCel(dustMat, 0);
  213.         MaterialAnim(dustMat, 5.0, 0);
  214.         AnimateSpriteSize(dustThing0, dustStart, dustEnd, 4.0);
  215.         AnimateSpriteSize(dustThing1, dustStart, dustEnd, 4.0);
  216.         
  217.         Sleep(2.0);
  218.         
  219.         # return camera to player
  220.         SetCurrentCamera(1);    
  221.         
  222.         # swap bridges
  223.         DestroyThing(fallingBridge);
  224.         CreateThing(fallenRopes, ghostRopes);
  225.             
  226.         # change surface attributes
  227.         #SetFaceGeoMode(surf1,4);                # draw textured faces
  228.         #SetFaceGeoMode(surf2,4);
  229.         #SetFaceGeoMode(surf3,4);
  230.         #SetFaceGeoMode(surf4,4);
  231.         
  232.         #SetAdjoinFlags(surf1, 0x0010);          # set face no move
  233.         #SetAdjoinFlags(surf2, 0x0010);
  234.         #SetAdjoinFlags(surf1, 0x00002000);      # set face climbable
  235.         #SetAdjoinFlags(surf2, 0x00002000);
  236.             
  237.         # retexture the bridge faces
  238.         #for (i=0;i<3;i=i+1)
  239.         #{
  240.         #    SetSurfaceMat(surf0[i], mat0);
  241.         #}
  242.             
  243.         # return control to player
  244.         ClearActorFlags(player, 0x200000);
  245.         EndCutscene();
  246.     }
  247.                 
  248.     return;
  249.            
  250. # ========================================================================================
  251.  
  252. pulse:
  253.  
  254.     PlaySoundThing(sndBridge0[RandBetween(0, 1)], staticBridge, vol, minDist, maxDist, 0x0);
  255.     return;
  256.     
  257. # ========================================================================================
  258.  
  259. callback:
  260.  
  261.     if (sndFalling == 0)
  262.     {
  263.         PlaySoundThing(sndFall, fallingBridge, 1.0, -1, -1, 0x0);
  264.         PlaySoundThing(sndBridge1, fallingBridge, 1.0, -1, -1, 0x0); 
  265.         sndFalling = 1;
  266.     }
  267.         
  268.     else if  (sndFalling == 1)
  269.     {
  270.         PlaySoundThing(sndHit1, fallingBridge, 1.0, -1, -1, 0x0);
  271.         sndFalling = 2;
  272.     }
  273.         
  274.     else if  (sndFalling == 2)
  275.     {
  276.         PlaySoundThing(sndHit2, fallingBridge, 0.5, -1, -1, 0x0);
  277.         sndFalling = 3;
  278.     }
  279.         
  280.     else
  281.     {
  282.         PlaySoundThing(sndBridge0, fallingBridge, 1.0, -1, -1, 0x0);
  283.     }
  284.  
  285.     return;
  286.  
  287. # ========================================================================================
  288.  
  289. end
  290.  
  291.